<%@  language="JSCRIPT" %>
<!-- #include virtual="/OxWebCATI/includes/IO.asp" -->
<%
    var usr = String(Request("USR"));
    var idx = parseFloat(Request("IDX"));

    idx++;

    if (LatestHtmlIndex(usr) != Session("LAST_PAGE_MONITORED"))
    {
        Response.Write("document.location.href = \"/oxWebCATI/admin/monitor.asp?USR=" + usr + "&IDX=" + LatestHtmlIndex(usr) + "\";");
    }
    else
    {
        if (IsDataAvailable(usr, idx))
        {
            if (IsHtml(usr, idx))
            {
                if (LatestHtmlIndex(usr) == idx)
                {
                    Response.Write("document.location.href = \"/oxWebCATI/admin/monitor.asp?USR=" + usr + "&IDX=" + idx + "\";");
                }
                else
                {
                    Response.Write("document.location.href = \"/oxWebCATI/admin/monitor.asp?USR=" + usr + "&IDX=0\";");
                }
            }
            else
            {
                ReplayEvents(usr, idx);
            }
        }
    }
%>